﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Guoc.DAL.Common
{
    [Serializable]
    /// <summary>
    /// 实体基类
    /// </summary>
    public class BaseEntity
    {
        private string _id = string.Empty;
        /// <summary>
        /// 字符串类型Guid编号,对应每个表中的主键ID
        /// </summary>
        public virtual string ID
        {
            get { return _id == string.Empty ? Guid.NewGuid().ToString().ToUpper() : _id; }
            set { _id = value; }
        }
        /// <summary>
        /// 更新版本，用于乐观锁并发控制。不是每个表都会映射该字段
        /// </summary>
        public virtual int Version { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public virtual DateTime CreateTime { get; set; }
    }
}
